import request from '@/utils/request'

const api_name = '/selection'

export default {
    getById(id) {
        return request({
            url: `${api_name}/getById?id=${id}`,
            method: 'get'
        })
    },
    selectPage(current, limit, selection) {
        return request({
            url: `${api_name}/selectPage?current=${current}&limit=${limit}`,
            method: 'post',
            data: selection  //使用json
        })
    },
    // 每门课程多少学生修
    selectStudentCount(params) {
        return request({
            url: `${api_name}/selectStudentCount`,
            method: 'get',
            params: params
        })
    },
    //每个学生修了多少门课
    selectCourseCount(current, limit) {
        return request({
            url: `${api_name}/selectCourseCount?current=${current}&limit=${limit}`,
            method: 'get'
        })
    },
    selectByStudentNumber(studentNumber) {
        return request({
            url: `${api_name}/selectByStudentId?studentNumber=${studentNumber}`,
            method: 'get'
        })
    },
    selectList() {
        return request({
            url: '${api_name}/selectList',
            method: 'get'
        })
    },
    selectCourse(studentId, scheduleId) {
        return request({
            url: `${api_name}/selectCourse`,
            method: 'post',
            params: {studentId, scheduleId},
            data: {}
        })
    },
    //修改课程设置
    updateScore(selection) {
        return request({
            url: `${api_name}/updateScore`,
            method: 'put',
            data: selection
        })
    },
    //批量删除
    removeByIds(idList) {
        return request({
            url: `${api_name}/removeByIds`,
            method: 'delete',
            data: idList
        })
    }
}
